function pageInit(){
	getData(getDataUrl, requestParam);
	resData             = resData.data;
	console.log(resData);
	$('.tag_lottery_title').html(resData.lotteryInfo.title);
	$('.tag_lottery_icon_style').addClass(resData.lottCateInfo.tags);
	$('.tag_lott_shangqi').html(resData.shangqi.period);
	var now_timestamp   = (Date.parse(new Date()) / 1000) * 1; // js的时间戳会带毫秒
	
	// 载入同种类型的彩种
	lottery_list();
	// 上期开奖
	clearTimeout(clear_kj_ready);
	// 检查上期是否有开奖
	clear_kj_ready = setTimeout('shangqi_kaijiang("' + resData.shangqi.code + '")', 2000);
	// 检查是否用户正在投注中， 如果有选择追号，则需要重新生成期号信息
	if($('.tag_i_want_chase[ami="2"]').prop('checked')){
		fb_buildChaseList();
	}
	
	// 如果当前没有期号，做一个提示
	if(!$.isEmptyObject(resData.lotting)){
		$('.tag_lott_lotting').html(resData.lotting.period);
		$('.tag_lott_next').html(resData.nextbet.period);
		// 当前期号结束时间减掉当前时间戳为剩下时间
		running_time = resData.lotting.stoptime - resData.ftime;
		daojishi();
	}else{
		$('.tag_lott_lotting').html('----');
		$('#tag_runningtime').html('暂未开始！');
	}
	
}

/**
 * 同种类型的彩种列表
 */
function lottery_list(){
	var str = '';
	$.each(resData.lotteryList, function (index, value){
		if(value.id == resData.lotteryInfo.id){
			str += '<li class="active tag_lottery_item" ami="' + value.id +'">' + value.title + '</li>';
		}else{
			str += '<li class="tag_lottery_item" ami="' + value.id +'">' + value.title + '</li>';
		}
	})
	$('.tag_lottery_list').html(str);
}

/**
 * 选择主玩法填充从玩法
 * @returns
 */
var type_code   = '';
var follow_code = '';
function fillFollowPlay (obj=''){
	$('#id_current_mainplay').html($('#id_main_play li[class="curr"]').html());
	$('#id_lott_play_follow').html('');
	
	// 置空从玩法
	play_follow = {'follow_index':'', 'base':''};
	var str     = '';
	$.each(play_main.base.playType, function (i, v){
		// 如果请求来源于切换玩法，则重新设定从玩法内容
		if(i == $(obj).attr('amv')){
			play_follow.follow_index = i;
			play_follow.base         = play_main.play[i];
		}
		str  = '<li>';
		str += '	<span class="tag_lott_play_main_name">' + v.title + '</span>';
		str += '	<div class="tag_lott_play_follow">';
		$.each(v.followPlay, function (i1, v1){
			if($.isEmptyObject(play_follow.base)){
				play_follow.follow_index = i + '|' + i1;
				type_code                = i;
				follow_code              = i1;
				play_follow.base         = v1;
				play_group               = i;
			}
			str += '	<a href="javascript:void(0);"  href="javascript:void(0);" class="tag_followplay_item" amv="' + i + '|' + i1 + '">' + v1.title + '</a>';
		});
		str += '	</div>';
		str += '</li>';
		$('#id_lott_play_follow').append(str);
	})
	$('#id_lott_play_follow a').eq(0).addClass('curr');
	user_play   = play_main.main_index + '-' + play_follow.follow_index;
	$('#id_now_play_title').html(play_main.base.title + ' ' + play_follow.base.title);
	ready_bet             = {};
	betting[user_play]     = {
		'1'   : [],
		'2'   : [],
		'3'   : [],
		'4'   : [],
		'5'   : [],
	};
}

/**
 * 更新玩法操作界面
 * @returns
 */
function fillPlayBody(){
	$('.tag_play_explain').html(play_follow.base.play_explain);
	$('#id_bet_example').html(play_follow.base.example);
	// 用户当前选择的玩法信息
//	console.log(play_main.main_index + '-' + type_code + '|' + follow_code);
//	console.log(resData.codeKeyList[play_main.main_index + '-']);
	var nowPlay = resData.codeKeyList[play_main.main_index + '-'][type_code + '|'][follow_code];
	if(!$.isEmptyObject(nowPlay)){
		// 选择从玩法，加载从玩法方式内容与说明
		$('.tag_play_explain').html(nowPlay.explain);
		// 动态读取该用户在当前彩种玩法中的实际赔率信息
		$('.tag_pc_bonus').html(nowPlay.odds);
		$('.tag_exp_odds').html(nowPlay.odds);
	}else{
		$('.hoverContent table').html('');
		// 玩法中，赔率随投注内容而变化的情况 
		var jiangjinxiangqing = '<tr><th>猜中</th><th>单注最高奖金</th></tr>';
		$('.hoverContent table').append(jiangjinxiangqing);
		$.each(resData.codeKeyList[play_main.main_index + '-'], function (i, v){
			if(v['foll_encode'].indexOf(play_follow.follow_name) != -1){
				jiangjinxiangqing = '<tr class="tag_tmp_odds_remark"><td>' + v.foll_title + '</td><td>' + v.odds + '<td></tr>';
				$('.hoverContent table').append(jiangjinxiangqing);
			}
		})
		// 选择从玩法，加载从玩法方式内容与说明
		$('.tag_play_explain').html('多重玩法');
	}
	// 填充玩法区域内容
	$('.tag_play_content').html('');
	var content  = '';
	// 选项标识的唯一ID
	var item_id  = '';
	// 玩法内容
	var playData = '';
	if(play_follow.base.item.option == 'import'){
		content += '<div class="textareaNumber">';
		content += '	<div class="numberImport">';
		content += '		<a href="javascript:void(0);"  href="javascript:void(0);"  class="submitBtn tag_import_betting">导入注单</a> ';
		content += '		<input type="file" class="tag_import_filebtn" style="display: none;" />'; 
		content += '		<a href="javascript:void(0);"  href="javascript:void(0);"  class="selectEg">查看标准格式样本 </a> ';
		content += '		<div class="EgContent">';
		content += '			<ul>';
		content += '				<li>01 02 03</li>';
		content += '				<li>03 07 09</li>';
		content += '				<li>02 05 08</li>';
		content += '				<li>04 05 06</li>';
		content += '			</ul>';
		content += '		</div>';
		content += '	</div> ';
		content += '	<div class="fileUpload"></div>'; 
		content += '	<div class="numberTextarea">';
		content += '		<textarea class="betNote tag_import_content" name="reday_bet"></textarea>'; 
		content += '		<p class="noteTip tag_import_tips"> 说明： <br /> 1、请参照&quot;标准格式样本&quot;格式录入或上传方案。 <br /> 2、每一注号码之间请使用空格分开，每注之间以回车、逗号或分号进行分隔 <br /> 3、文件格式必须是.txt格式。 <br /> 4、文件较大时会导致上传时间较长，请耐心等待！ <br /> 5、导入文本内容后将覆盖文本框中现有的内容。 </p>';
		content += '	</div> ';
		content += '	<div class="numberBtn">';
		content += '		<a href="javascript:void(0);"  class="submitBtn tag_clear_error">删除错误项</a>&nbsp;'; 
		content += '		<a href="javascript:void(0);"  class="submitBtn tag_check_import">检查格式是否正确</a>&nbsp;'; 
		content += '		<a href="javascript:void(0);"  class="submitBtn tag_import_func_clear">清空文本框</a>';
		content += '	</div>';
		content += '</div>';
	}else{
		content += '<div class="sscCheckNumber">';
		content += '	<ul>';
		content += '		<li>';
		$.each(play_follow.base.item, function (index, value){
			if($.inArray(play_follow.follow_index, ['ZHI_X|HZ', 'ZU_X|HZ']) > -1){
				content += '		<div class="fix selectMini">';
			}else{
				content += '		<div class="fix selectSYX5">';
			}
			if(value.name){
				content += '		<span class="buyNumberTitle">' + value.name + '<i></i></span>';
			}
			playData = resData.playItem.baseItem[value.option];
			if(playData.min){
				content += '			<div class="buyNumber fix">';
				for(var i = playData.min; i <= playData.max; i++){
					content += '			<a href="javascript:void(0);"  class="tag_choice_item" group="' + index + '" ami="' + i + '" ><span>' + i + '</span></a>';
				}
			}else{
				content += '			<div class="buyNumber fix" style="text-align: center;">';
				$.each(playData.routine, function (i, v){
					content += '			<a href="javascript:void(0);"  class="tag_choice_item" group="' + index + '" ami="' + v + '" ><span>' + v + '</span></a>';
				})
			}
			content += '				</div>';
			
			if(value.func == 'funcItem'){
				content += '		<div class="buyNumberFilter">';
				$.each(resData.playItem.funcItem, function (fi, fv){
					content += '<a href="javascript:void(0);"  class="tag_func_btn" ami="' + fv.ami + '" group="' + index + '">' + fv.title + '</a>';
				})
				content += '		</div>';
			}
			content += '		</div>';
		});
	}
	$('.tag_play_content').html(content);
	$('.tag_bet_operation').html(function (){
		var str = '	<p class="betTotal">';
		str += '	您选择了<em class="tag_bet_count">0</em> 注，';
		str += '	<em class="inputAdd fix">';
		str += '		<i class="off tag_multiple_subtract">-</i> ';
		str += '		<input type="tel" value="1" class="tag_multiple"> ';
		str += '		<i class="tag_multiple_add">+</i>';
		str += '	</em> 倍';
		str += '	<select style="position: static; opacity: 10;" class="tag_money_unit">';
		$.each(resData.playItem.bet_money_info.money_unit, function (i,v){
			bet_money_unit = bet_money_unit ? bet_money_unit : i;
			str += '<option value="' + v.amount + '" ami="' + i + '">' + v.title + '</option>';
		})
		str += '	</select>';
		str += '	共 <i class="tag_show_bet_amount">0.00</i>元';
		str += '</p>';
		str += '<a href="javascript:void(0);"  class="betBtn tag_selection_bet">确认选号</a>';
		return str;
	});
	// 检查输入内容
	check_import_betting();
	
	ready_bet             = {};
	betting[user_play]     = {
		'1'   : [],
		'2'   : [],
		'3'   : [],
		'4'   : [],
		'5'   : [],
	};
}

/**
 * 根据预投注内容计算有效投注数
 */
var valid_betnum = 0;
var js_bet_item  = { '1' : [], '2' : [], '3' : [], '4' : [], '5' : [] };
function bet_jisuan(){
	// 有效的投注数
	var valid_betnum = 0;
	if($.isEmptyObject(ready_bet) || $.isEmptyObject(ready_bet.bet_item)){
		$('.tag_show_bet_amount').html(0);
		$('.tag_bet_count').html(valid_betnum);
		return;
	}
	var multiple     = $('.tag_multiple').val();
	$.each(ready_bet.bet_item, function (i, v){
		if(v.check == 'success'){
			if(v.nums){
				// 如果有单独设置注数，则单独累加
				valid_betnum += v.nums;
			}else{
				valid_betnum++;
			}
		}
		// 倍数
		ready_bet.bet_item[i].multiple = multiple;
		// 金额
		ready_bet.bet_item[i].eo_money = default_bet_money;
	})
	$('.tag_bet_count').html(valid_betnum);
	// 获取金额单位
	var money_unit_dom = $('.tag_money_unit').find("option:selected");
	var money_unit     = money_unit_dom.val();
	var amount         = 0; 
	// 开始计算金额:  默认每注金额 * 金额单位 * 投注组数 * 投注倍数
	amount = parseFloat(default_bet_money * money_unit * multiple * valid_betnum).toFixed(2);
	ready_bet.lott_id        = resData.lotteryInfo.id;
	ready_bet.bet_money_unit = money_unit;
	ready_bet.bet_zhushu     = valid_betnum;
	ready_bet.multiple       = multiple;
	ready_bet.bet_amount     = parseFloat(amount).toFixed(2);
	ready_bet.maxwinner      = (valid_betnum * multiple * money_unit * play_follow.base.winnerMoney * default_bet_money).toFixed(2);
	ready_bet.betting        = betting[user_play];
	ready_bet.period         = resData.lotting.id;
	ready_bet.odds           = play_follow.base.winnerMoney;
	ready_bet.default_bet_money = default_bet_money;
	$('.tag_show_bet_amount').html(amount);
}

/**
 * 用户选择的投注项增加到购物车中
 */
function addCart(){
	if(ready_bet.bet_zhushu <= 0) return;
	// 清除选项中无用的投注数据（用户手动输入的时候，如果输入了奇葩选项）
	var checkBet = ready_bet.bet_item;
	var tmp      = [];
	$.each(checkBet, function (i, v){
		if(v.check == 'success'){
			// 移除无用数据(直接循环删除， 会有问题，移除之后数据源的下标立刻就变了)
			tmp.push(v);
		}
	});
	ready_bet.bet_item = tmp;
	// 记录当前加入购物车的序号，用作对应删除购物车
	cart_index++;
	// 计算用户投注的内容，以后不用重复计算
	var bettingData       = ready_bet.betting;
	var bet_string        = '';
	if(!$.isEmptyObject(bettingData[1])){
		bet_string += bettingData[1].join(' ') + ', ';
	}
	if(!$.isEmptyObject(bettingData[2])){
		bet_string += bettingData[2].join(' ') + ', ';
	}
	if(!$.isEmptyObject(bettingData[3])){
		bet_string += bettingData[3].join(' ') + ', ';
	}
	if(!$.isEmptyObject(bettingData[4])){
		bet_string += bettingData[4].join(' ') + ', ';
	}
	if(!$.isEmptyObject(bettingData[5])){
		bet_string += bettingData[5].join(' ');
	}
	ready_bet.bet_string  = bet_string;
	ready_bet.cart_index  = cart_index;
	// 基础投注金额
	ready_bet.eo_money    = default_bet_money;
	betCart.push(ready_bet);
	// 初始化投注预览
	reBetInit();
	reBuildCart();
	// 购物车结算简览
	balanceCart();
}

/**
 * 删除购物车
 */
function dropCart(index){
	var drop_id = 0;
	$.each(betCart, function (i, v){
		drop_id = i;
		// 获取到当前购物车中要删除选项的下标
		if(v.cart_index == index) return false;
	})
	// 删除投注项
	betCart.splice(drop_id, 1);
	$('#id_cart_nums').html(betCart.length);
	if(betCart.length == 0){
		$('#id_cart_nums').hide();
	}
	
	// 重构购物车
	reBuildCart();
}

/**
 * 结算购物车
 */
var single_zhushu = 0;
var single_amount = 0;
function balanceCart(chase=true){
	// 空购物车
	single_zhushu = 0;
	single_amount = 0;
	if(chase){
		$.each(betCart, function (i, v){
			single_zhushu += v.bet_zhushu;
			single_amount += parseFloat(v.bet_amount);
		})
	}
	$('.tag_tongji_zhushu').html(single_zhushu);
	$('.tag_tongji_amount').html(single_amount);
}

/**
 * 重构购物车
 */
function reBuildCart(){
	$('.tag_checkList').html(function (){
		$(this).html('');
		var str          = '';
		var play_str     = '';
		var play_type    = '';
		var play_type_st = '';
		var cn_money_unit= '';
		$.each(betCart, function (i, v){
			var bet_string = v.bet_string;
			var len = bet_string.length;
			if(bet_string[len-1]==" "){
				bet_string = v.bet_string.substring(0,len-2);
			}
			play_type    = v.bet_name.split('-');
			play_type_st = play_type[1].split('|');
			play_str     = resData.playItem.mainPlay[play_type[0]].title + ' ' + resData.playItem.mainPlay[play_type[0]].playType[play_type_st[0]].title + ' ' + resData.playItem.mainPlay[play_type[0]].playType[play_type_st[0]].followPlay[play_type_st[1]].title;
			str     = '<tr>';
			str    += '		<td amv="' + v.cart_index + '">';
			str    += '			<i class="order_type">';
			str    += '				<span>[' + play_str + '] ' + bet_string + '</span><span>...</span>';
			str    += '			</i>';
			str	   += '			<a href="javascript:void(0);"  class="orderDetail tag_betting_detail" amv="' + v.bet_string + '" m="' + play_type[0] +'" f="' + play_type[1] + '">详细</a></td>';
			str    += '		</td>';
			str    += '		<td>' + v.bet_zhushu + '注</td>';
			str    += '		<td>' + v.multiple + '倍</td>';
			
			switch(v.bet_money_unit.toString()){
				case '0.1':
					cn_money_unit = '角';
					break;
				case '0.01':
					cn_money_unit = '分';
					break;
				default:
					cn_money_unit = '元';
					break;
			}
			str    += '		<td>' + v.bet_money_unit + '</td>';
			str    += '		<td>可中金额<i class="orderMoney">' + (v.maxwinner) + '<i>元</i></i></td>';
			str    += '		<td></td>';
			str    += '		<td><i class="orderCancel tag_del_bet" amv="' + v.cart_index + '">删除</i></td>';
			str    += '</tr>';
			$('.tag_checkList').append(str);
		});
	});
}


/**
 * 重选玩法，初始化投注预览
 */
function reBetInit(){
	ready_bet             = {};
	betting[user_play]    = {
		'1'   : [],
		'2'   : [],
		'3'   : [],
		'4'   : [],
		'5'   : [],
	};
	// 初始化页面选择项
	fillPlayBody();
	reBetView();
}

/**
 * 构建追号信息选择列表
 */
function buildChaseList(group=0){
	var showPreRow = 0;
	var multiple   = $('#tag_set_chase_beishu').val();
	switch(group.toString()){
		case '1':
			break;
		default:
			// 默认普通追号
			// 获取设置显示追号期数数量
			showPreRow = $('#tag_set_chase_qishu').val();
			break;
	}
	
	$('.tag_chase_list tr:gt(0)').remove();
	var str = '';
	$.each(resData.chasePreiod, function (i, v){
		if(i == showPreRow) return false;
		str  = '<tr>';
		str += '	<td>' + parseInt(i+1) + '</td>';
		str += '	<td><label><input type="checkbox" class="tag_main_chase_preiod" value="' + v.period + '" ami="' + v.id + '" amv="' + i + '">' + v.period + '<em>' + (i?'':'(当前期)') + '</em></label></td>';
		str += '	<td><input type="tel" ami="' + i + '" value="' + multiple + '" class="tag_main_chase_beishu"> 倍</td>;'
		str += '	<td id="tag_main_chase_item_' + i + '" amv="0.00">￥ 0.00元</td>';
		str += '	<td>' + v.expect_opentime + '</td>';
		str += '</tr>';
		$('.tag_chase_list tbody').append(str);
	})
}

/**
 * 翻倍追号：生成追号期数
 */
function fb_buildChaseList(){
	// 选择方案
	var plan = 0;
	$.each($('.tag_fanbei_plan'), function(i, v){
		if($(v).prop('checked')) {
			plan = i;
			return false;
		}
	})
	// 展示追号期数
	var showPreRow = $('#tag_chase_fanbei_qishu').val();
	// 初始倍数
	var multiple   = $('#tag_chase_fanbei_qsbeishu').val();
	// =========================================
	// 每隔多少期
	var jg_qishu   = $('#id_every_qishu').val();
	// 几何倍数
	var jh_beishu  = $('#id_beishu_for').val();
	// =========================================
	// 前？期
	var befor_qishu= $('#id_befor_qishu').val();
	// 之后倍数
	var behind_beishu = $('#id_behind_beishu').val();


	// 起始期

	var begin_qi      = $('.tag_chase_fanbei').val();
	$('.tag_chase_list tr:gt(0)').remove();
	var blData        = [];
	var now_preiod    = '';
	$.each(resData.chasePreiod, function (i, v){
		if (!now_preiod) now_preiod = v.id;
		if(v.id < begin_qi) return true;
		blData.push(v);
	});
	
	var dangqianqi = '';
	if(plan == 1){
		// 第二套追号方案生成
		var str = '';
		$.each(blData, function (i, v){
			if (i == showPreRow) return false;
			if (i > 4) multiple = behind_beishu;
			if (v.id == now_preiod) dangqianqi = '当前期';
			str  = '<tr>';
			str += '	<td>' + parseInt(i+1) + '</td>';

			str += '	<td><label><input type="checkbox" class="tag_main_chase_preiod" value="' + v.period + '" ami="' + v.id + '" amv="' + i + '">' + v.period + '<em>' + dangqianqi + '</em></label></td>';


			str += '	<td><input type="tel" ami="' + i + '" value="' + multiple + '" class="tag_main_chase_beishu"> 倍</td>;'
			str += '	<td id="tag_main_chase_item_' + i + '" amv="0.00">￥ 0.00元</td>';
			str += '	<td>' + v.expect_opentime + '</td>';
			str += '</tr>';
			$('.tag_chase_list tbody').append(str);
			dangqianqi = '';
		})
	}else{
		// 第二套追号方案生成
		var str = '';
		$.each(blData, function (i, v){
			if (i == showPreRow) return false;
			if (i > 1 && !(i % jg_qishu)) multiple = multiple * jh_beishu;
			if (v.id == now_preiod) dangqianqi = '当前期';
			str  = '<tr>';
			str += '	<td>' + parseInt(i+1) + '</td>';

			str += '	<td><label><input type="checkbox" class="tag_main_chase_preiod" value="' + v.period + '" ami="' + v.id + '" amv="' + i + '">' + v.period + '<em>' + dangqianqi + '</em></label></td>';

			
			str += '	<td><input type="tel" ami="' + i + '" value="' + multiple + '" class="tag_main_chase_beishu"> 倍</td>;'
			str += '	<td id="tag_main_chase_item_' + i + '" amv="0.00">￥ 0.00元</td>';
			str += '	<td>' + v.expect_opentime + '</td>';
			str += '</tr>';
			$('.tag_chase_list tbody').append(str);
			dangqianqi = '';
		})
	}
}

/**
 * 获取用户设置追号的数据（期数=>倍数）
 */
var chasePeriodData = [];
function getChasePeriodData(){
	var tongji_zhushu = 0;
	var tongji_qishu  = 0; 
	var tongji_amount = 0;
	chasePeriodData   = [];
	$.each ($('.tag_main_chase_preiod'), function (i, v){
		if($(v).prop('checked')){
			// 选中的期号的倍数
			chasePeriodData.push($(v).attr('ami') + '_' + $('.tag_main_chase_beishu[ami="' + i + '"]').val());
			tongji_zhushu += single_zhushu * $('.tag_main_chase_beishu[ami="' + i + '"]').val();
			tongji_amount += single_amount * $('.tag_main_chase_beishu[ami="' + i + '"]').val();
			// 设置金额预览
			$('#tag_main_chase_item_' + i).html('￥ ' + (single_amount * parseInt($('.tag_main_chase_beishu[ami="' + i + '"]').val())).toFixed(2) + '元');
		}else{
			$('#tag_main_chase_item_' + i).html('￥ 0.00元');
		}
	})
	$('#id_tongji_zhushu').html(tongji_zhushu);
	$('#id_tongji_qishu').html(chasePeriodData.length);
	$('#id_tongji_amount').html(tongji_amount.toFixed(2));
}

/**
 * 展示提交内容
 */
function showBet(obj, chase){
	var qihao_str = '第<em class="fill layerIssue">' + resData.lotting.period + '</em>期';
	var group_ind = $('.tag_chase_type li[class="curr"]').index();
	if(chase){
		// 构建追号的期号数信息
		var qiList      = $('.tag_main_chase_preiod[group="' + group_ind + '"]');
		var chase_first = ''
		var chase_end   = '';
		var chase_qis   = 0;
		$.each(qiList, function (i, v){
			if($(v).prop('checked')){
				if(chase_first == ''){
					chase_first = $(v).val();
				}else{
					chase_end   = $(v).val();
				}
				chase_qis++;
			}
		})
		qihao_str = chase_first + '期 至第' + chase_end + '期 共' + chase_qis + '期';
	}
	var playTmp       = '';
	var str = '<div id="CheckBetLayer" class="lotteryConfirm"> ';
	str    += '	<ul>';
	str    += '		<li><span>彩种：</span><em class="fill">' + resData.lotteryInfo.title + '</em></li>';
	str    += '		<li><span>期号：</span>' + qihao_str + '</li>';
	str    += '		<li><span>详情：</span>';
	str    += '		<div class="fill textarea">';
	$.each(betCart, function (i, v){
		tmp_mp = v.bet_name.split('-');
		tmp_fp = tmp_mp[1].split('|');
		str += '		<p>[' + resData.playItem.mainPlay[tmp_mp[0]].title  + ',' + 
						resData.playItem.mainPlay[tmp_mp[0]].playType[tmp_fp[0]].followPlay[tmp_fp[1]].title + '] ' +  v.bet_string + '<br />';
	});
	str    += '		</div>';
	str    += '	</ul>';
	str += '</div>';
	layer.open({
        title: '温馨提示',
        content: str,
        className: 'layui-m-tag-msg',
        btn: ['确定', '取消'],
        yes: function (index){
        	doBet(obj, chase)
        },
    });
}

//安全提交
var securityPost       = true;
/**
 * 投注
 */
function doBet(obj, chase){
	if(securityPost == false){
		showMsg('温馨提示', '请等待提交结果');
		return;
	}
	// 锁定提交
	securityPost = false;
	if(betCart.length <= 0) {
		showMsg('温馨提示', '请选择有效的投注号');
		return;
	}
	var param    = {'lott_id':resData.lotteryInfo.id, 'cart':betCart};
	// 默认普通投注的数据
	param.chasePeriodData = [resData.lotting.id + '_'];
	// 检查是否有追号设置
	if(chase){
		// 设置追号的倍数与期数
		param.chasePeriodData = chasePeriodData;
		param.chase           = true;
	}
	// pc平台提交
	param.platform = 1;
	// 安全提交限制
	securityPost = false;
	$.ajax({  
		type:'post',    
	    url: doBetUrl,  
	    data:'data=' + JSON.stringify(param),  
	    cache:false,  
	    dataType:'json',
	    success:function(res){  
	    	if(res.status == 'success'){
	    		showMsg('温馨提示', '<span style="color:red">投注成功</span>，您可以在我的账户查看注单详情', 'success');
	    		clearCart();
	    		// 初始化投注预览
	    		reBetInit();
			}else{
				showMsg('温馨提示', '投注失败，请重试', '');
			}
	    	// 释放提交
	    	securityPost = true;
	    },
	    error:function (XMLHttpRequest, textStatus, errorThrown){
	    	// 释放提交
	    	securityPost = true;
	    }
	})
}
/**
 * 填充追号起始期
 */
function setChaseBeginPreiod(){
	if($.isEmptyObject(resData.chasePreiod)) return;
	var str = '';
	$.each(resData.chasePreiod, function (i, v){
		str = '<option value="' + v.id + '">' + v.period + '</option>';
		$('.tag_chase_fanbei').append(str);
	});
}

/**
 * 填充追号起始期
 */
function setChaseBeginPreiod(){
	if($.isEmptyObject(resData.chasePreiod)) return;
	var str = '';
	$.each(resData.chasePreiod, function (i, v){
		str = '<option value="' + v.id + '">' + v.period + '</option>';
		$('.tag_chase_fanbei').append(str);
	});
}

/**
 * 清空购物车
 */
function clearCart(){
	$('.tag_checkList tbody').html('');
	$('.tag_chase_number').hide();
	betCart = [];
	// 重新结算数据
	balanceCart();
	// 页面样式初始化
	$('.tag_tongji_zhushu').html('0');
	$('.tag_tongji_amount').html('0.00');
	ready_bet             = {};
	betting[user_play]    = {
		'1'   : [],
		'2'   : [],
		'3'   : [],
		'4'   : [],
		'5'   : [],
	};
}


/**
 * 初始化投注预览
 */
function reBetView(){
	// 初始化底部投注预览信息
	$('#id_sscFooter').removeClass('active');
	$('#id_choice_zhushu').html('0');
	$('#id_choice_amount').html('0.00');
	$('#id_betting_str').html('');
	$('#id_user_bet_beishu').val('1');
	$('.tag_money_unit').removeClass('curr');
	$('.tag_money_unit:eq(0)').addClass('curr');
	$('#id_user_bets_set').hide();
	$('#id_cart_nums').html(betCart.length);
	$('#id_cart_nums').show();
}
